﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>我的日报</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />

    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script>

        var model = avalon.define({
            $id: "USUERGZRZLIST",
            GZtype: "",
            selGZType: "",
            GZTypeData: [],
            CommonData: [],
            TotalCount: 0,
            UserCount: 0,
            selContent: "",
            content: "",
            page: 0,
            AddGZRZ:function(){
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD.html?FormCode=GZRZADD&FrameName=frameGZRZ", "添加数据", "1000", "");
            },
            GetGZDataList: function () {
                model.page++;
                if (model.selGZType != model.GZtype || model.selContent != model.content) {
                    model.page = 1;
                }
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERGZRZLIST', { P1: model.GZtype, p: model.page, P2: model.content }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        if (model.selGZType == model.GZtype && model.selContent == model.content) {
                            if (resultData.Result.length < 5) {
                                model.CommonData.pushArray(resultData.Result);
                                $("#btnmore").prop("disabled", true);
                                $("#btnmore").text("没有更多的数据了");
                            } else {
                                model.CommonData.pushArray(resultData.Result);
                                $("#btnmore").prop("disabled", false);
                                $("#btnmore").text("加载更多");
                            }
                        } else {
                            if (resultData.Result.length < 5) {
                                $("#btnmore").prop("disabled", true);
                                $("#btnmore").text("没有更多的数据了");
                            }
                            model.CommonData = resultData.Result;
                            model.selGZType = model.GZtype;
                            model.selContent = model.content;
                        }
                       
                    }
                     
                })

            },
            GetGZType: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 7 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.GZTypeData = resultData.Result;
                        model.GetGZDataList();

                    }
                })
            },
            DELGZRZ: function (item) {
                if (confirm("确定要删除日报么？")) {
                    $.post('/API/FTAPI.ashx?Action=DELGZRZBYID', { "P1": item.ID }, function (result) {
                        result = JSON.parse(result)
                        if (result.ErrorMsg == "") {
                            parent.ComFunJS.winsuccess("删除成功");
                            model.CommonData.remove(item);
                        } else {
                            parent.ComFunJS.winwarning(result.ErrorMsg);
                        }
                    })
                }
            },
            EDITGZRZ: function (ID)
            {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD.html?FormCode=GZRZADD&FrameName=frameGZRZ&ID=" + ID, "修改数据", "1000", "");
            },
            AddPL: function (item, dom) { 
                var plcontent = dom.val();
                if ($.trim(plcontent) == "")
                {
                    parent.ComFunJS.winwarning("请输入批注内容");
                    return;
                }
                $.post('/API/FTAPI.ashx?Action=ADDCOMENT', { "P1": plcontent, "MsgType": "GZRZ", "MsgLYID": item.ID }, function (result) {
                    var result = $.parseJSON(result);
                    if (result.ErrorMsg == "") {
                        item.PLList.push(result.Result)
                        dom.val("")
                    }
                })
            },
            jptj: function (event, item, dom) {
                if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
                    model.AddPL(item, dom);
                }
            },
        });
        avalon.ready(function () {
            model.GetGZType();
            $.getJSON('/API/FTAPI.ashx?Action=GETGZRZMENUCOUNT', function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.TotalCount = resultData.Result;
                    model.UserCount = resultData.Result1;

                }
            })
        })

        $(document).ready(function () {
            $(".hidPan").live("click",function () {
                $(this).parent().find(".panel-body,.panel-footer").toggle('normal');
            }) 
        });
    </script>
</head>
<body ms-controller="USUERGZRZLIST">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        <div style="width:200px;position:absolute">
            <div class="panel panel-default">
                <div class="panel-body text-center">
                    <a href="#" id="btADD" ms-click="AddGZRZ()" style=" height: 34px;line-height: 34px;" class="button button-glow button-border button-rounded button-primary"><i class="fa fa-plus"></i>添加日报</a>
                </div>
            </div>
            <div class="list-group ">
                <a href="/View/APPBaseView/APP_GZRZ.html" class="list-group-item  active" style="padding-left: 15px"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;&nbsp;我的日报<span class="badge" ms-text="UserCount" ms-if="UserCount>0"></span></a>
                <a href="/View/APPBaseView/APP_GZRZ_BranchList.html" class="list-group-item" style="padding-left: 15px"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;&nbsp;部门日报列表<span class="badge" ms-text="TotalCount" ms-if="UserCount>0"></span></a>
            </div>
        </div>
        <div class="row contentdv" style="margin-left:201px">
            <div class="col-xs-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-10">
                                <div class="input-group">
                                    <div class="input-group-addon">查询条件</div>
                                    <select class="form-control" ms-duplex="GZtype" style="width:30%" ms-change="GetGZDataList()">
                                        <option value="">全部日报类型</option>
                                        <option ms-repeat-item="GZTypeData" ms-attr-val="item.TypeNO" ms-change="GetGZDataList()">{{item.TypeNO}}</option>
                                    </select>
                                    <input id="tbSearch" class="form-control" style="width:70%" type="text" ms-duplex="content" placeholder="输入日报内容查询" />
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" ms-click="GetGZDataList()">查询</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-xs-2">
                            </div>
                            <div class="col-xs-4">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default " ms-repeat-item="CommonData">
                    <span class="label label-info deldata" ms-click="EDITGZRZ(item.ID)" style="right:50px;">修改</span>
                    <span class="label label-danger deldata" ms-click="DELGZRZ(item)">删除</span>
                    <div class="panel-heading hidPan">
                        <span class="glyphicon glyphicon-minus"></span><span class="panel-title">
                            &nbsp;[{{item.Remark}}]{{item.RBDate|date("yyyy-MM-dd")}}[by{{item.CRUserName}}]  <span class="label label-danger" style="border-radius: 25PX;" ms-if="ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), item.CRDate.substring(0,10)) == 0||ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), item.CRDate.substring(0,10)) == -1">新!</span>             <!--ms-if-->
                        </span>
                    </div>
                    <div class="panel-body" style="margin-bottom:0px;">
                        <blockquote>
                            <p ms-html="item.RBContent"></p>
                            <footer>日报内容 </footer>
                            <p ms-html="item.RBWCQK" ms-if="item.RBWCQK!=''"></p>
                            <footer ms-if="item.RBWCQK!=''">完成情况 </footer>
                        </blockquote>
                        <label ms-if="item.FileList.length>0"> 附件：</label><a style="margin-left:10px" ms-repeat-files="item.FileList" target="_blank" download="filename" ms-attr-href="ComFunJS.FilePathAPI+files.FileMD5">{{files.Name+'.'+files.FileExtendName}}</a>
                    </div>
                    <div class="panel-footer" style="overflow: hidden;">
                        <div class="chat-widget" style="margin-top: 10PX; margin-bottom: 10px">
                            <ul class="list-unstyled">
                                <!--ms-repeat-start-->
                                <!--repeat498387512983754309602854494005442-->
                                <li class="by-me Yan-comment" ms-repeat-el="item.PLList">
                                    <div class="avatar" style="float: left">
                                        <img alt="" ms-attr-src="'/images/TX/'+el.CRUser+'.jpg'" style="width:65px;height:65px" onerror="javascript: this.src = '/images/TX/default.png'">

                                    </div>
                                    <div class="chat-content">
                                        <div class="chat-meta">{{el.CRUserName}} <span style="float: right"><!--ms-if-->{{el.CRDate|date("MM月dd日 HH:mm")}}</span></div>
                                        {{el.MSGContent}}
                                        <div class="clearfix"></div>
                                    </div>
                                </li><!--repeat498387512983754309602854494005442-->
                            </ul>
                        </div>
                        <div class="input-group">
                            <input class="form-control" type="text" ms-keypress="jptj(event,item,$(this))" placeholder="此处添加批注(按Ctrl+Enter直接提交)" />
                            <span class="input-group-btn">
                                <button type="button" data-loading-text="正在保存..." class="btn  btn-info addTL" autocomplete="off" ms-on-click="AddPL(item,$(this).parent().parent().find('input'))">
                                    添加批注
                                </button>
                            </span>
                        </div>
                    </div>
                </div>
                <button type="button" class="btn btn-default btn-lg btn-block" id="btnmore" ms-click="GetGZDataList()">加载更多</button>
            </div>
        </div>
    </div>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js" type="text/javascript"></script>
    <link href="/JqueryPlug/umeditor122/themes/default/css/umeditor.css" type="text/css" rel="stylesheet" />
    <script src="/JqueryPlug/umeditor122/umeditor.js" type="text/javascript" charset="utf-8"></script>
    <script src="/JqueryPlug/umeditor122/umeditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
</body>
</html>
